fix: log audit log failures instead of dropping them#1769
Conversation
Audit log writes in the connect handlers discarded their error. Check the error and record it through the existing error logger. Requests still succeed when the audit write fails. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Legacy audit log writes in the membership, deleter, and organization services discarded their error. Log a warning when the write fails. The calling operation still succeeds. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Warning Review limit reached
Next review available in: 36 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughAudit logging across core services and Connect API handlers now checks returned errors and emits structured warnings or service-error logs. Primary organization, membership, policy, project, role, service-user, and user operations retain their existing control flow and responses. ChangesAudit logging error handling
Estimated code review effort: 3 (Moderate) | ~20 minutes Possibly related PRs
Suggested reviewers: 🚥 Pre-merge checks | ✅ 2✅ Passed checks (2 passed)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Coverage Report for CI Build 29570336713Coverage decreased (-0.1%) to 45.975%Details
Uncovered Changes
Coverage Regressions7 previously-covered lines in 3 files lost coverage.
Coverage Stats
💛 - Coveralls |
Inject a failing audit repository into the handler context and verify SetOrganizationKyc still succeeds. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Summary
Legacy audit log writes (
audit.Logger.Log/LogWithAttrs) discarded their error in the connect handlers and in three core services. Failures are now logged. The calling operation still succeeds, matching the existing handling inCreateOrganization.Changes
ErrorLoggerwith operation tag<RPC>.AuditLogcore/membership: log audit log failures through the service's slog loggercore/deleter,core/organization: log audit log failures throughslog.WarnContextlogAuditForCheck,auditPolicyCreationEvent) log throughslog.ErrorContextTechnical Details
No caller-visible behavior change: an audit log failure never fails the request.
Test Plan
go test ./internal/api/v1beta1connect/ ./core/membership/ ./core/deleter/ ./core/organization/passes